<ion-view view-title="天风宝">
    <ion-nav-buttons side="left">
        <back-button></back-button>
    </ion-nav-buttons>
    <div class="bar tab clearfix has-header" ng-class="{'has-loading': isOffline}">
        <ul>
            <li ng-repeat="channel in channels" ng-class="{current: vm.activeTab == channel.id}" style="width:50%">
                <em ng-click="vm.activeTab= channel.id">{{channel.catalog_name}}</em></li>
        </ul>
    </div>
    <ion-content class="has-subheader" ng-class="{'has-loading': isOffline}">

        <ion-refresher pulling-text={{PULLING_TEXT}} pulling-icon="" refreshing-text={{REFRESHING_TEXT}}
                       on-refresh="doRefresh()"></ion-refresher>
        <div ng-repeat="channel in channels" ng-show="vm.activeTab == channel.id">
            <div class="promo">
                <img ng-src="{{channel.large_icon}}" alt="{{channel.catalog_name}}" ng-click="showAds($index, true)"/>
            </div>

            <div class="term tianfeng">

                <div class="panel" ng-repeat="fund in channel.products" ng-if="channel.remark=='otc'">
                    <a ng-href="#/tab/{{fund.prod_catalog_mark == 'otcfdsy' ? 'product-item-otc-float' : 'product-item-otc'}}/{{fund.prod_code}}">
                        <h2 class="item">{{fund.prod_name | defString}}<sup>{{fund.prod_duration | defNumber:null:'天，保本'}}</sup></h2>
                        <ins ng-if="fund.otc_status==0">距抢购日还剩{{fund.bengin_date_show | defString}}天</ins>
                        <div class="item">
                            <p ng-if="fund.prod_catalog_mark == 'otcfdsy'"><em class="inc">{{fund.prod_profit_rate_min|defNumber:0}}<sub>% ~</sub>{{fund.prod_profit_rate_max|defNumber:0}}<sub>%</sub></em>预期年化收益率</p>
                            <p ng-if="fund.prod_catalog_mark != 'otcfdsy'"><em ng-class="{inc_ : fund.prod_profit_rate < 0}">{{fund.prod_profit_rate | defNumber :4}}<sub>%</sub></em>预期收益率</p>
                            <p><em ng-bind-html="fund.prod_min_subscribe"></em>起购金额</p>
                            <span ng-if="fund.sell_status == 2" class="btn disable">购买</span>
                            <span ng-if="fund.sell_status == 3" class="btn disable">已售罄</span>
                            <span ng-if="fund.sell_status == 4" class="btn disable">暂停申购</span>
                            <span ng-if="fund.sell_status == 5" class="btn disable">暂停交易</span>
                        </div>
                    </a>
                    <a ng-if="fund.sell_status == 1" class="btn"
                       buy-button prod_code="{{fund.prod_code}}" prod_source="1" >购买</a>
                </div>

                <div class="panel" ng-repeat="fund in channel.products" ng-if="channel.remark!='otc'">
                    <a href="#/tab/product-item/{{fund.prod_code}}" >
                        <h2 class="item">{{fund.prod_name | defString}}<sup>{{fund.prod_duration | defNumber:null:'天，保本'}}</sup></h2>
                        <div class="item">
                            <p ng-if="'fdxqszg'==fund.prod_catalog_mark">
                                <em ng-class="{inc_ : fund.price_increase_year < 0}">{{fund.price_increase_year | defNumber :4}}<sub>%</sub></em>近一年涨幅
                            </p>
                            <p ng-if="'fdxqszg'!=fund.prod_catalog_mark">
                                <em ng-class="{inc_ : fund.prod_profit_rate < 0}">{{fund.prod_profit_rate | defNumber :4}}<sub>%</sub></em>预期收益率
                            </p>
                            <p><em>{{fund.prodNav | defNumber:4}}<sub>元</sub></em>单位净值</p>
                            <p><em ng-bind-html="fund.prod_min_subscribe"></em>起购金额</p>
                        </div>
                    </a>
                </div>
            </div>
        </div>

    </ion-content>
</ion-view>